package com.dp.vo;

import java.io.Serializable;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Embeddable;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

@Embeddable
public class NewsRssChannelPK  implements Serializable{
	@Basic(optional = false)
	@JoinColumn(name = "channelid", referencedColumnName = "channleid")   
	@ManyToOne
    private NewsExtendsChannel newsExtendsChannel;		//所属ebook内容
	@Basic(optional = false)
	@Column(name = "rssurl")
	private String rssurl;                   
	
	public NewsRssChannelPK(){
	}
    public NewsRssChannelPK(Integer channelid,String rssurl){
		this.newsExtendsChannel=new NewsExtendsChannel(channelid);
		this.rssurl=rssurl;
	}
    public NewsRssChannelPK(NewsExtendsChannel newsExtendsChannel,String rssurl){
		this.newsExtendsChannel=newsExtendsChannel;
		this.rssurl=rssurl;
	}
	public NewsExtendsChannel getNewsExtendsChannel() {
		return newsExtendsChannel;
	}
	public void setNewsExtendsChannel(NewsExtendsChannel newsExtendsChannel) {
		this.newsExtendsChannel = newsExtendsChannel;
	}
	public String getRssurl() {
		return rssurl;
	}
	public void setRssurl(String rssurl) {
		this.rssurl = rssurl;
	}
	
	@Override
	public int hashCode() {
	        int hash = 0;
	        hash += (newsExtendsChannel.getChannleid() != null ? newsExtendsChannel.getChannleid().hashCode() : 0);
	        hash += (rssurl != null ? rssurl.hashCode() : 0);
	        return hash;
	}

    @Override
	public boolean equals(Object object) {
	    if (!(object instanceof NewsRssChannelPK)) {
	          return false;
	     }
	    NewsRssChannelPK other = (NewsRssChannelPK) object;
	     if ((this.newsExtendsChannel.getChannleid() == null && other.newsExtendsChannel.getChannleid() != null) || (this.newsExtendsChannel.getChannleid() != null && !this.newsExtendsChannel.getChannleid().equals(other.newsExtendsChannel.getChannleid()))) {
	         return false;
	     }
	     if ((this.rssurl == null && other.rssurl != null) || (this.rssurl != null && !this.rssurl.equals(other.rssurl))) {
	         return false;
	     }
	     return true;
	}
	    
	@Override
    public String toString() {
		Integer channelid=newsExtendsChannel==null?null:newsExtendsChannel.getChannleid();
		return "com.dp.vo.NewsRssChannelPK[channelid=" + channelid+ ",rssurl="+rssurl+"]";
    }
    
	
	
}
